package com.zking.web;

import com.zking.dao.domain.Department;
import com.zking.service.DepartmentService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import javax.swing.plaf.synth.SynthSpinnerUI;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

@Controller
@RequestMapping(value = "/department",name = "科室")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    /**
     * 显示所有的科室
     * @param model
     * @return
     */
    @RequiresPermissions("department:showDepartments")
    @RequestMapping(value = "/showDepartments" ,name="显示科室")
    public String query_All_department(Model model){
        List<Department> departments = departmentService.queryDepartments();
        model.addAttribute("departments",departments);
        return "backend_page/department";
    }
}
